#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define maxsize 1001
struct customer
{
    int data[maxsize];
    int top;
};
struct customer *create_stack()
{
    struct customer *stack;
    stack=(struct customer*)malloc(sizeof(struct customer));
    stack->top=-1;
    return stack;
}
void push(struct customer *stack,int num_of_cus)
{
    stack->data[++stack->top]=num_of_cus;
}
int pop(struct customer *stack)
{
    if(stack->top==-1) return -1;
    return stack->data[stack->top--];
}
int main()
{
    int n,i,j,k,num_of_cus,time,now,max,link_of_cus[1001],control=0;
    struct customer *stack1,*stack2;
    stack1=create_stack();
    stack2=create_stack();
    scanf("%d",&n);
    for(k=1;k<=n;k++)
    {
        scanf("%d",&link_of_cus[k]);
    }
    for(i=n;i>=1;i--)
    {
       num_of_cus=link_of_cus[i];
        if(num_of_cus%2==1) push(stack1,num_of_cus);
        else push(stack2,num_of_cus);
    }
    for(time=1;stack1->top!=-1||stack2->top!=-1;time++)
    {
        now=pop(stack1);
        if(now!=-1)
        {
            if(control!=0) printf(" ");
            else control=1;
            printf("%d",now);
        }
        if(time%2==0)
        {
            now=pop(stack2);
            if(now!=-1)
            {
                if(control!=0) printf(" ");
                else control=1;
                printf("%d",now);
            }
        }
    }

    return 0;
}
